<header class="data-table-header p+">
    <div class="data-table-header__label">
        <span style="float:left;" ng-if="objectConfig.base.opera.search" >
            <lx-search-filter ng-enter="search(searchStr)" ng-click="search(searchStr)" model="searchStr" placeholder="搜索" ></lx-search-filter>
        </span>
        <button class="btn btn--s btn--blue-grey btn--raised" ng-click="filterShow()" ng-if="objectConfig.base.opera.filter"  lx-ripple lx-tooltip="{{isfilterArr?'存在高级搜索项':''}}">
            <i class="mdi mdi-filter-variant" ></i>&nbsp;高级&nbsp;
            <i class="mdi mdi-alert-circle tc-red-500" ng-if="isfilterArr" ></i>
        </button>
        <button class="btn btn--s btn--blue-grey btn--raised" ng-click="index()" lx-ripple>
            <i class="mdi mdi-refresh"></i>
        </button>
        <button class="btn btn--s btn--blue-grey btn--raised" ng-click="create()" ng-if="objectConfig.base.opera.store"  lx-ripple>
            <i class="mdi mdi-plus"></i>&nbsp;新建
        </button>
        <button class="btn btn--s btn--blue-grey btn--raised" ng-click="export_dis()" ng-if="is_zrq_discount==true&&need_admin"  lx-ripple>
        生成会员折现表
        </button>
        <div  ng-model="need_admin" style="display:none"></div>
        <button class="btn btn--s btn--blue-grey btn--raised" ng-click="export_pass()" ng-if="is_zrq_discount==true&&need_admin"  lx-ripple>
            一键审核
        </button>
    </div>
    <div class="data-table-header__actions">
 

        <button class="btn btn--s btn--blue-grey btn--raised" ng-disabled="1 == pager.currentPage" ng-click="pageNumChange(pager.currentPage-1)" lx-ripple> < </button>
        <span class="tc-grey-500" style="line-height:30px;" >&nbsp;{{pager.currentPage}}&nbsp;/&nbsp;{{pager.lastPage}}&nbsp;</span>
        <button class="btn btn--s btn--blue-grey btn--raised" ng-disabled="pager.lastPage == pager.currentPage" ng-click="pageNumChange(pager.currentPage+1)" lx-ripple > > </button>

    </div>
</header>

<table class="data-table" >
    <thead>
        <tr class="data-table__selectable-row">
            <th></th>
            <th ng-class="{'data-table__sortable-cell':field.in_sort,
                'data-table__sortable-cell--desc':field.in_sort && sortField==field.name && field.sort_value,
                'data-table__sortable-cell--asc':field.in_sort && sortField==field.name && !field.sort_value}" 
                ng-click="sortChange(field)" ng-if="field.in_list" ng-repeat="field in objectConfig.fields">         
                <span ng-if="field.relate" > {{field.relate.comment || field.relate.name}}</span>
                <span ng-if="!field.relate" > {{field.comment || field.name}} </span>{{field.sortValue}}
            </th>
            <th ng-if="is_zrq_discount!=true">
            	操作
            </th>
        </tr>
    </thead>
    
    <tbody >
        <tr class="data-table__selectable-row {{bgColorList && 'bgc-'+bgColorList.color[object[bgColorList.field]]}}" ng-click="stateGo(object)" ng-repeat="object in objects" >
            <td></td>
            <td ng-if="field.in_list" ng-repeat="field in objectConfig.fields">
            	<span ng-if="field.type == 'string' || field.type == 'number' || field.type == 'decimal'">
                    {{object[field.name]}}
                </span>

                <span ng-if="field.type == 'relate'">
                    {{object[field.relate.table+'_'+field.relate.select]}}
                </span>

                <span ng-if="field.type == 'boolean'" ng-click="$event.stopPropagation();">
                    <input type="checkbox" id="switch_{{field.name}}_{{object.id}}" ng-if="field.in_store" class="switch__input" ng-model="object[field.name]" ng-change="update(object,field.name);"  >
                    <label ng-if="field.in_store" for="switch_{{field.name}}_{{object.id}}" class="switch__label">{{object[field.name]?"是":"否"}}</label>
                    <label ng-if="!field.in_store">{{object[field.name]?"是":"否"}}</label>
                </span>

                <span ng-if="field.type == 'datetime'" title="{{object[field.name]}}"  >
                    {{object[field.name]}}
                </span>

                <span ng-if="field.type == 'img'" >
                    <lx-thumbnail thumbnail-src="{{object[field.name]}}" thumbnail-width="80" thumbnail-height="60"></lx-thumbnail>
                </span>

                <span ng-if="field.type == 'enum'" >
                    {{field.enum[object[field.name]].value}}
                </span>
            </td>
          	<td ng-if="is_zrq_discount!=true">
                <lx-dropdown  ng-click="$event.stopPropagation();" position="right">
                    <button class="btn btn--s btn--blue-grey btn--flat" lx-ripple lx-dropdown-toggle>
                        <i class="mdi mdi-opera"></i>&nbsp;操作
                    </button>      
                    <lx-dropdown-menu class="" >
                        <ul>
                            <li>
                                <a class="dropdown-link" ng-click="show(object);" ng-if="objectConfig.base.opera.update">
                                    <i class="mdi mdi-pencil"></i><span>编辑</span>
                                </a>
                            </li>
                            <li>
                                <a class="dropdown-link" ng-click="destroy(object);" ng-if="objectConfig.base.opera.destroy">
                                    <i class="mdi mdi-delete"></i><span>删除</span>
                                </a>
                            </li>
                            <li ng-if="menuList" class="dropdown-divider"></li>
                            <li ng-repeat="opera in menuList">
                                <a class="dropdown-link" ng-click="stateGo(object,opera);">
                                    <i class="mdi mdi-{{opera.ico}}"></i><span>{{opera.name}}</span>
                                </a>
                            </li>
                            <li ng-if="operaList" class="dropdown-divider"></li>
                            <li ng-repeat="opera in operaList">
                                <a class="dropdown-link" ng-click="operaGo(object,opera);">
                                    <i class="mdi mdi-{{opera.ico}}"></i><span>{{opera.name}}</span>
                                </a>
                            </li>
                        </ul>
                    </lx-dropdown-menu>
                </lx-dropdown>
          	</td>
        </tr>
    </tbody>
    
</table>

<lx-dialog class="dialog dialog--l" id="showDialog" auto-close="true">
    <div class="dialog__header">
        <div class="toolbar bgc-blue-grey-800 pl++">
            <span class="toolbar__label tc-white fs-title">
                {{object.id?"更新":"添加"}} {{objectConfig.base.comment || objectConfig.base.name}}
            </span>
        </div>
    </div>

    <div class="dialog__content p++">
        <div id="include" ng-include="'views/object/object_show.html'"></div>
    </div>

    <div class="dialog__actions">
        <button class="btn btn--m btn--black btn--flat" lx-ripple lx-dialog-close>取消</button>
        <button class="btn btn--m btn--blue  btn--flat" ng-click="store(object)" ng-if="!object.id" lx-ripple>添加</button>
        <button class="btn btn--m btn--blue  btn--flat" ng-click="update(object)" ng-if="object.id" lx-ripple>更新</button>
    </div>
</lx-dialog>

<lx-dialog class="dialog dialog--l" id="filterDialog" auto-close="true">
    <div class="dialog__header">
        <div class="toolbar bgc-blue-grey-800 pl++">
            <span class="toolbar__label tc-white fs-title">
                搜索 {{objectConfig.base.comment || objectConfig.base.name}}
            </span>
        </div>
    </div>

    <div class="dialog__content p++">
        <div id="include" ng-include="'views/object/object_filter.html'"></div>
    </div>

    <div class="dialog__actions">
        <button class="btn btn--m btn--black btn--flat" lx-ripple lx-dialog-close>取消</button>
        <button class="btn btn--m btn--blue  btn--flat" ng-click="filter()" lx-ripple>搜索</button>
    </div>
</lx-dialog>


<!-- 自定义的Dialog -->
<lx-dialog class="dialog dialog--l" id="changePwdDialog" objectId='' auto-close="true">
    <div class="dialog__header">
        <div class="toolbar bgc-blue-grey-800 pl++">
            <span class="toolbar__label tc-white fs-title">
                修改密码
            </span>
        </div>
    </div>

    <div class="dialog__content p++">
        <div class="p++" style="max-width:800px;">
            <div style="position:relative;" >
                <span  class="not-null-tip"></span>
                <!--text-field-->
                <lx-text-field  label="新密码" >
                    <input type="text"  ng-model="object['passNew']" >
                </lx-text-field>           
            </div>
            <div style="line-height:30px;color:red;display:none" id="change_pwd_alert"></div>
        </div>
    </div>

    <div class="dialog__actions">
        <button class="btn btn--m btn--black btn--flat" lx-ripple lx-dialog-close>取消</button>
        <button class="btn btn--m btn--blue  btn--flat" ng-click="changePassword(object)" lx-ripple>确认</button>
    </div>
</lx-dialog>

<lx-dialog class="dialog dialog--l" id="postMessage" objectId='' type='' auto-close="true">
    <div class="dialog__header">
        <div class="toolbar bgc-blue-grey-800 pl++">
            <span class="toolbar__label tc-white fs-title">
                发送消息
            </span>
        </div>
    </div>

    <div class="dialog__content p++">
        <div class="p++" style="max-width:800px;">
            <div style="line-height:30px;color:red;display:none" id="post_message_alert"></div>
            <div style="position:relative;" >
                <span  class="not-null-tip"></span>
                <!--text-field-->
                <lx-text-field  label="标题" >
                    <input type="text"  ng-model="object['title']" >
                </lx-text-field>           
            </div>
            <div style="position:relative;">
                <span  class="not-null-tip"></span>
                <!-- content-field -->
                <div style="font-size:0.5em;color:gray;margin-top:10px;width:90%;">
                    <p>内容</p>
                    <div  class="ueditor" config="ueditorConfig" ng-model="object['content']" ></div>                  
                </div>
            </div>
        </div>
    </div>

    <div class="dialog__actions">
        <button class="btn btn--m btn--black btn--flat" lx-ripple lx-dialog-close>取消</button>
        <button class="btn btn--m btn--blue  btn--flat" ng-click="postMessage(object)" lx-ripple>确认</button>
    </div>
</lx-dialog>

<lx-dialog class="dialog dialog--l" id="discountListBox" objectId='' type='' auto-close="true" style="min-height:500px;">
    <div class="dialog__header">
        <div class="toolbar bgc-blue-grey-800 pl++">
            <span class="toolbar__label tc-white fs-title">
                折现记录
            </span>
        </div>
    </div>

    <div style="padding:15px 0 15px 24px;border-bottom:1px solid #ececec;">
        <span>当前月份：</span>
        <input ng-model="packetAdmin" id="packetAdmin" type="date" style="width:150px;border:1px solid #ececec;padding-left:5px;"  ng-change="change()">
    </div>
    <table class="data-table ng-scope">
        <thead class="data-table">
            <tr>
                <th>({{discounts.district}})未抢完红包剩余积分</th>
                <th>({{discounts.district}})申请兑换积分之和</th>
                <th>({{discounts.district}})未申请积分之和</th>
                <th>({{discounts.district}})总计</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>{{discounts.remain_packet}}</td>
                <td>{{discounts.discount_apply}}</td>
                <td>{{discounts.user_remain_point}}</td>
                <td>{{discounts.total}}</td>
            </tr>
        </tbody>
    </table>
    <div class="dialog__actions">
        <button class="btn btn--m btn--black btn--flat" lx-ripple lx-dialog-close>取消</button>
        <button class="btn btn--m btn--blue  btn--flat" lx-dialog-close lx-ripple>确认</button>
    </div>
</lx-dialog>

<lx-dialog class="dialog dialog--l" id="refereeBox" objectId='' type='' auto-close="true" style="min-height:500px;">
    <div class="dialog__header">
        <div class="toolbar bgc-blue-grey-800 pl++">
            <span class="toolbar__label tc-white fs-title">
                推荐的人
            </span>
        </div>
    </div>
    <header class="data-table-header p+">
        <div class="data-table-header__label">
        </div>
        <div class="data-table-header__actions" >
            <button class="btn btn--s btn--blue-grey btn--raised" ng-model="currentPage"  ng-disabled="1 == currentPage" ng-click="pageNumChange(currentPage-1)" lx-ripple> < </button>
            <span class="tc-grey-500" style="line-height:30px;" >&nbsp;{{currentPage}}&nbsp;/&nbsp;{{lastPage}}&nbsp;</span>
            <button class="btn btn--s btn--blue-grey btn--raised" ng-model="lastPage" ng-disabled="lastPage == currentPage" ng-click="pageNumChange(currentPage+1)" lx-ripple > > </button>
        </div>
    </header>
    <table class="data-table ng-scope">
        <thead class="data-table ng-scope">
            <tr>
                <th>姓名</th>
                <th>电话</th>
                <th>地区</th>
            </tr>
        </thead>
        <tbody >
            <tr ng-repeat="item in referee">
                <td>{{item.name}}</td>
                <td>{{item.phone}}</td>
                <td>{{item.zrq_district_name}}</td>
            </tr>
        </tbody>
    </table>
    <div class="dialog__actions">
        <button class="btn btn--m btn--black btn--flat" lx-ripple lx-dialog-close>取消</button>
        <button class="btn btn--m btn--blue  btn--flat" lx-dialog-close lx-ripple>确认</button>
    </div>
</lx-dialog>